<?php 
	session_start();
	
	require_once('../config/config-inc.php');
	require_once('../classes/class.user.php');
	
	$url_sess_id = $_GET["id"];
	$usr_sess_id = $_SESSION["user"]['sess_id'];
	
	// Redirect back to login page if the user has not logged in or when he tries to access this page directly.
	if(! isset($_SESSION["user"]) || (isset($_SESSION["user"]) && (strcmp($url_sess_id,$usr_sess_id) != 0)))
	{
		header("location:login.php?sess=failed");
	}
	elseif( ! isset($_COOKIE['sudeep_isLoggedIn']))		// Redirects to homepage after 1 hour. **Need to reset cookie to another 1 hr in every page after login** 
	{
		header("location:login.php?sess=expired");
	}
	
	$common_params = "?id=".$url_sess_id;
	
	
	
	
?>
	<html>
	<head>
	<head>
	<title>sudeep.co.in | admin</title>
	<link rel="stylesheet" href="css/style_1.css" type="text/css" />
	
	<link rel="stylesheet" type="text/css" href="css/menu/ddsmoothmenu.css" />
	<link rel="stylesheet" type="text/css" href="css/menu/ddsmoothmenu-v.css" />
	
	<script type="text/javascript" src="js/menu/menu-jquery.min.js"></script>
	<script type="text/javascript" src="js/menu/ddsmoothmenu.js">
	
	/***********************************************
	* Smooth Navigational Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
	* This notice MUST stay intact for legal use
	* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
	***********************************************/
	
	</script>
	
	<script type="text/javascript">
	
	ddsmoothmenu.init({
		mainmenuid: "smoothmenu1", //menu DIV id
		orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
		classname: 'ddsmoothmenu', //class added to menu's outer DIV
		//customtheme: ["#1c5a80", "#18374a"],
		contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
	})
	
	ddsmoothmenu.init({
		mainmenuid: "smoothmenu2", //Menu DIV id
		orientation: 'v', //Horizontal or vertical menu: Set to "h" or "v"
		classname: 'ddsmoothmenu-v', //class added to menu's outer DIV
		//customtheme: ["#804000", "#482400"],
		contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
	})
	
	</script>
	
	</head>
	<body>
	<table class="header" cellpadding="0" cellspacing="0" border="0" width="100%">
		<tr>
			<td>
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr>
						<td width="1%">&nbsp;</td>
						<!--<td width="15%" class="top-menu-1"><a href="#">My account</a> | <a href="#">Settings</a> | <a href="#">Contact us</a></td>-->
						<td width="70%"><span class="quote_1">"There should be a better way to start a day than waking up every morning ..."</span></td>
						<td width="28%" class="top-menu-1"><font color="#e6e6e6">Welcome, <b><?php echo $_SESSION["user"]['fullname'];?></b></font> | <a href="account.php<?php echo $common_params;?>&mode=view">My account</a> | <a href="login_auth.php<?php echo $common_params;?>&act=logout">Logout</a></td>
						<td width="1%">&nbsp;</td>
					</tr>
				</table>
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr>
						<td width="3%" class="top-menu-2"><img src="images/logo.png" /></td>
						<td width="68%" class="top-menu-2"><!-- Admin--></td>
						<td width="30%" class="top-menu-2" align="center">
							<table class="top-menu-2_1_tbl" cellpadding="0" cellspacing="0" border="0" width="65%" align="right">
								<tr>
									<td class="top-menu-2_1">Logged in as: <?php echo "<b>".$_SESSION["user"]['id']."</b> [".$_SESSION["user"]['access_level']."]";?></td>
								</tr>
								<tr>
									<td class="top-menu-2_1">Last login: <?php echo $_SESSION["user"]['last_login'];?></td>
								</tr>							
							</table>
						</td>
						<td width="3%" class="top-menu-2">&nbsp;</td>
					</tr>
				</table>
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr>
						<td>&nbsp;</td>
	 					<td width="100%" class="top-menu-3">
							<div id="smoothmenu1" class="ddsmoothmenu">
								<ul align="center">
									<li><a href="<?php echo "home.php$common_params";?>">Home</a></li>
									<li><a href="/dashboard.php<?php echo $common_params;?>">Dashboard</a></li>
									<li><a href="/mailbox.php<?php echo $common_params;?>">Messages</a></li>
									<li><a href="#">Tools</a>
										<ul>
											<li><a href="#">RSS Reader</a></li>
											<li><a href="/expenses.php<?php echo $common_params;?>">Expense Tracker</a></li>
											<li><a href="../apps/bookmarks">BookMarker</a></li>
											<li><a href="#">IMessage</a></li>
											<li><a href="#">eMail</a></li>
										</ul>
									</li>
									<li><a href="/site_stats.php<?php echo $common_params;?>">Site Statistics</a></li>
									<li><a href="http://www.sudeep.co.in/cpanel" target="_blank">Hosting CPanel</a></li>
									<li><a href="#">Administration</a>
										<ul>
											<li><a href="#">Manage Accounts</a></li>
											<li><a href="#">Thought for the Day</a></li>
											<li><a href="#">Site</a></li>
												<ul>
													<li><a href="#">Contents</a></li>
													<li><a href="#">Configuration</a></li>
												</ul>
											<li><a href="login_auth.php<?php echo $common_params."&";?>act=logout">Logout</a></li>
										</ul>
									</li>
								</ul>
							</div>
						</td>
						<td>&nbsp;</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	</body>
	</html>